/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.comac.ins.common.core.domain.R;
import com.comac.ins.common.log.annotation.Log;
import com.comac.ins.common.log.enums.BusinessType;
import com.comac.ins.common.mybatis.core.page.TableDataInfo;
import com.comac.ins.common.web.core.BaseController;
import com.comac.ins.isfd.domain.bo.IsfdLayupSkinPropertieBo;
import com.comac.ins.isfd.domain.bo.query.IsfdLayupSkinPropertieQueryBo;
import com.comac.ins.isfd.domain.vo.IsfdLayupSkinPropertieVo;
import com.comac.ins.isfd.service.IIsfdLayupSkinPropertieService;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 【铺层库蒙皮属性】
 *
 * @author Lion Li
 * @date 2024-08-02
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/isfd/layupSkinPropertie")
public class IsfdLayupSkinPropertieController extends BaseController {

    private final IIsfdLayupSkinPropertieService isfdLayupSkinPropertieService;

    /**
     * 查询【铺层库蒙皮属性】列表
     */
    @SaCheckPermission("isfd:layupSkinPropertie:list")
    @PostMapping("/list")
    public TableDataInfo<IsfdLayupSkinPropertieVo> list(@RequestBody IsfdLayupSkinPropertieQueryBo queryBo) {
        return isfdLayupSkinPropertieService.queryPageList(queryBo);
    }

    /**
     * 导出【铺层库蒙皮属性】列表
     */
    @SaCheckPermission("isfd:layupSkinPropertie:export")
    @Log(title = "【铺层库蒙皮属性】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(@RequestBody IsfdLayupSkinPropertieQueryBo queryBo, HttpServletResponse response) {
        isfdLayupSkinPropertieService.export(queryBo, response);
    }

    /**
     * 获取【铺层库蒙皮属性】详细信息
     *
     * @param id 主键
     */
    @SaCheckPermission("isfd:layupSkinPropertie:query")
    @GetMapping("/{id}")
    public R<IsfdLayupSkinPropertieVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
        return R.ok(isfdLayupSkinPropertieService.queryById(id));
    }

    /**
     * 保存/修改【铺层库蒙皮属性】
     */
    @SaCheckPermission("isfd:layupSkinPropertie:save")
    @Log(title = "【铺层库蒙皮属性】", businessType = BusinessType.INSERT)
    @PostMapping("/save")
    public R<Void> save(@RequestBody IsfdLayupSkinPropertieBo bo) {
        return toAjax(isfdLayupSkinPropertieService.save(bo));
    }


    /**
     * 删除【铺层库蒙皮属性】
     *
     * @param ids 主键串
     */
    @SaCheckPermission("isfd:layupSkinPropertie:remove")
    @Log(title = "【铺层库蒙皮属性】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
        return toAjax(isfdLayupSkinPropertieService.deleteWithValidByIds(List.of(ids), true));
    }
}
